// import Vue from 'vue'
// import VueRouter from 'vue-router'

const Home = () => import('pages/home')
const MDoc = () => import('pages/m-doc')
const MVideo = () => import('pages/m-video')
const Question = () => import('pages/question')
const DocCard = () => import('pages/doc-card')
const VideoCard = () => import('pages/video-card')

// const qdvideo = () => import('pages/qdvideo')
// const Quill = () => import('pages/Quill-editor')
// const Editormd = () => import('pages/Editormd')
import store from '../store'

// Vue.use(VueRouter)
const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '1')
        next()
      }
    },
    {
      path: '/doc',
      name: 'DocCard',
      component: DocCard,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '2')
        next()
      }
    },
    {
      path: '/doc/:id',
      name: 'MDoc',
      component: MDoc,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '2')
        next()
      }
    },
    {
      path: '/question/:id?',
      name: 'Question',
      component: Question,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '4')
        next()
      }
    },
    {
      path: '/video',
      name: 'VideoCard',
      component: VideoCard,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '3')
        next()
      }
    },
    {
      path: '/learn/:id',
      name: 'MVideo',
      component: MVideo,
      beforeEnter: (to, from, next) => {
        store.commit('SWITCH_NAV', '3')
        next()
      }
    },
    // {
    //   path: '/video/:id',
    //   name: 'qdvideo',
    //   component: qdvideo,
    //   beforeEnter: (to, from, next) => {
    //     store.commit('SWITCH_NAV', '3')
    //     next()
    //   }
    // },
    // {
    //   path: '/live',
    //   name: 'Live',
    //   component: Live,
    //   beforeEnter: (to, from, next) => {
    //     store.commit('SWITCH_NAV', '3')
    //     next()
    //   }
    // }
  ]
})

// router.beforeEach((to, from, next) => {
//   console.log('store.state', store.state)
//   console.log('to', to)
//   next()
// })


export default router









